import os
import shutil

def delete_folder(path):
    for root, dirs, files in os.walk(path):
        for name in dirs:
            if name == "Binaries" or name == "Intermediate":
                folder_path = os.path.join(root, name)
                print("Deleting folder:", folder_path)
                try:
                    # 递归删除文件夹
                    shutil.rmtree(folder_path)
                except Exception as e:
                    print("Error:", e)

    for root, dirs, files in os.walk(path):
        for name in dirs:
            if name == "Plugins":
                plugin_path = os.path.join(root, name)
                for plugin_root, plugin_dirs, plugin_files in os.walk(plugin_path):
                    for plugin_name in plugin_dirs:
                        if plugin_name == "Binaries" or plugin_name == "Intermediate":
                            plugin_folder_path = os.path.join(plugin_root, plugin_name)
                            print("Deleting folder:", plugin_folder_path)
                            try:
                                # 递归删除文件夹
                                shutil.rmtree(plugin_folder_path)
                            except Exception as e:
                                print("Error:", e)

# 指定项目路径
path = "./"
print(path)

# 调用删除函数
delete_folder(path)